package comparer

import (
	"mig/pkg/data"
	"mig/pkg/types"
)

type Comparer interface {
	Compare(src data.Database, tgt data.Database, srcInfo *types.IntegrityInfo) (*types.CompareResult, error)
}

func NewComparer(algorithm types.Algorithm, chunkSize int64, maxWorkers int) Comparer {
	switch algorithm {
	case types.AlgorithmDigest, types.AlgorithmDigestV2:
		return NewDigestComparer(chunkSize, maxWorkers)
	case types.AlgorithmBloomFilter:
		return NewBloomFilterComparer(chunkSize, maxWorkers)
	case types.AlgorithmCommon:
		return NewCommonComparer(chunkSize, maxWorkers)
	default:
		return nil
	}
}
